define(function(require){
	var $ = require("jquery");
	var justep = require("$UI/system/lib/justep");
	var array = require("$UI/system/lib/base/array");
	var Model = function(){
		this.callParent();
	};

	Model.prototype.backBtnClick = function(event){
		justep.Shell.closePage();
	};

	Model.prototype.UserDataCustomRefresh = function(event){
		
		var Phone=localStorage.getItem('LoginState');
		var Img = this.comp('Img');
		var Nickname = this.getIDByXID('Nickname');
		var Name = this.getIDByXID('Name');
		var Gender = this.getIDByXID('Gender');
		var Autograph = this.getIDByXID('Autograph');
		var iPhone = this.getIDByXID('iPhone');
		var Mail = this.getIDByXID('Mail');
		justep.Baas.sendRequest({
			"url" : "/nase/nase_action",
			"action" : "queryNase_user",
			"async" : false,
			"params" : {},
			"success" : function(data) {
				array.each(data.rows, function(obj) {
					var fPhone = obj.fPhone.value;
					if(Phone == fPhone){
						var fImgUrl = require.toUrl(obj.fImgUrl.value);
						var fNickname = obj.fNickname.value;
						var fName = obj.fName.value;
						var fGender = obj.fGender.value;
						var fAutograph = obj.fAutograph.value;
						var fPhone = obj.fPhone.value;
						var fMail = obj.fMail.value;
						$(Img.domNode).find('img').attr({
							"src" : fImgUrl
						});
						document.getElementById(Nickname).innerHTML = '<h5 class="h5s cZnMbma">'+fNickname+'</h5>';
						document.getElementById(Name).innerHTML = '<h5 class="h5s cZnMbma">'+fName+'</h5>';
						document.getElementById(Gender).innerHTML = '<h5 class="h5s cZnMbma">'+fGender+'</h5>';
						if(fAutograph != undefined)
							document.getElementById(Autograph).innerHTML = '<h5 class="h5s cZnMbma">'+fAutograph+'</h5>';
						document.getElementById(iPhone).innerHTML = '<h5 class="h5s cZnMbma">'+fPhone+'</h5>';
						document.getElementById(Mail).innerHTML = '<h5 class="h5s cZnMbma">'+fMail+'</h5>';
					}
				});
			}
		});
	};

	Model.prototype.quitLoginClick = function(event){
		//localStorage.removeItem('LoginState');
		localStorage.setItem('LoginState', " ");
		justep.Shell.showPage("main");
		location.reload();
	};
	

	Model.prototype.modelModelConstruct = function(event){
		if(localStorage.getItem('LoginState') == " " || localStorage.getItem('LoginState') == undefined){
			justep.Shell.fireEvent("onHomeContent",{});
			justep.Shell.showMainPage();
		}
	};

	

	

	return Model;
});